<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Scroll Event Test</title>
<style>
    .wide {
        width: 2000px; /* 设置一个足够宽的宽度 */
        height: 100px;
        background-color: #ccc;
    }
</style>
</head>
<body>

<div class="wide"></div>

<script>
let lastScrollLeft = 0;

window.addEventListener('scroll', function() {
    const currentScrollLeft = window.pageXOffset || document.documentElement.scrollLeft;

    if (currentScrollLeft !== lastScrollLeft) {
        console.log('水平滚动发生');
        lastScrollLeft = currentScrollLeft;
    }
});
</script>

</body>
</html>
